﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="{$cfg_site_description}" />

<title>我的團購券|個人中心{$cfg_site_name}</title>
{template 'header'}




<body>
<div id="buy917_wrap">    
    <div id="buy917_header">
    	<div id="buy917_logo"><a href="index.php">Buy917</a></div>
        <div class="buy917_header_banner">
        	<div class="buy917_header_topbanner">
            	{template 'login_line'} <!-- login_line.html 登入/註冊按鈕 --> 
				<?php include("admin/event.php")?>
            </div>
          	<div class="buy917_header_select">
            	<div class="buy917_header_city">
                	 {if !empty($_cityid)}
                    <div class="guides">
                        <div class="city">
                            <h2>{$_cityname}</h2>
                        </div>
                        <div id="guides-city-change" class="change">切換城市</div>
                        <div id="guides-city-list" class="city-list">
                            <ul>
                            {loop $_citylist $v}
                                <li {if $v['cid']==$_cityid}class="current"{/if}><a href="index.php?cityid={$v['cid']}">{$v['cityname']}</a></li>
                            {/loop}
                            </ul>                   
                        </div>
                    </div>
                    {/if}	
                </div>
                <div class="buy917_header_group">
                	{template 'headergroup'}	
                </div>
            </div>
       </div>
    </div><!-- buy917_header -->
  
   {template 'menu_nav'} <!-- menu 導覽頁 --> 
       
    <div id="buy917_middle">
        	<div class="buy917_grouplist_top"></div>      
            <div class="buy917_grouplist_body"> 
				 <h2 class="abouth2">
					<ul>
						<li class="current"><a href="m.php?action=bond&type=available">我的團購券</a><span></span></li>
						<li><a href="m.php?action=orders&type=all">我的訂單</a><span></span></li>
						<li><a href="m.php?action=account">帳戶餘額</a><span></span></li>
						<li><a href="m.php?action=settings">帳戶設置</a><span></span></li>
					</ul>
				 </h2>
        		<div id="coupons">
    <div id="content" class="coupons-box">
       
            <div class="box-top"></div>
            <div class="box-content">
            	
                <div class="head">
                	<h3>Buy917團購網 - 我的團購卷列印</h3>
				</div>
				<!-- 未使用已使用 狀態來自  tg_groupbond.user_state  為使用者可以自己更改狀態
					已退款 、已過期  狀態來自  tg_groupbond.state  系統自設狀態
				 -->
                <div class="head">
                    <ul class="filter"><li class="label"><b style="float:left;">分類:</b> </li>
                    <li {if $type=='available'}class="current"{/if}><a href="{$theurl}&type=available">未使用</a></li>
                    <li {if $type=='used'}class="current"{/if}><a href="{$theurl}&type=used">已使用</a></li>
                    <li {if $type=='refuse'}class="current"{/if}><a href="{$theurl}&type=refuse">已退款</a></li>
                    <li {if $type=='expired'}class="current"{/if}><a href="{$theurl}&type=expired">已過期</a></li>
                    <!--<li {if $type=='all'}class="current"{/if}><a href="{$theurl}&type=all">所有</a></li></ul>-->           
                 </div>
                <div class="sect">
                                        
                 {if empty($value)}                       
                  <div class="notice">沒有相關數據</div>
                    
                 {else}
                    <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0" class="coupons-table" id="order-list">
    				<tbody><tr><th width="50%">團購項目</th><th>序列號</th><th >密碼</th><th>過期時間</th><th>狀態</th><th>操作</th></tr>
          		 {loop $value $n $r}
   				{if $r['gtitle'] !=null}
    				<tr {if $n%2==0} class="alt"{else}{/if}><td style="text-align: left;"><a target="_blank" href="view.php?gid={$r['gid']}" class="deal-title">{$r['gtitle']}</a></td><td>{$r['sn']}</td><td><span class="money">{strtoupper($r['password'])}</span></td><td>{date("Y-m-d",$r['endtime'])}<br/>{date("H:i",$r['endtime'])}</td>
	                    <td class="op" style="text-align:center" >
	                    	{if $type=='available' || $type=='used'}
								<script type="text/javascript">
									function change_user_state(bid){
										$.get("m.php?action=bond", { action: "ajax_change_user_state" , bid:bid  } , 
											function(date){
												jQuery("#user_state_"+bid).html(date);
												alert(date);	
											}
										 )
									}
								</script>
								{if $r['user_state']==0}
									<span id="user_state_{$r['bid']}" >未使用</span>
									<br /><input type="button" name="change_user_state" id="change_user_state" value="更改狀態" onclick="change_user_state({$r['bid']} );">
								{else}
									<span id="user_state_{$r['bid']}" >已使用</span>
									<br /><input type="button" name="change_user_state" id="change_user_state" value="更改狀態" onclick="change_user_state({$r['bid']} );">
								{/if}
							{else}
								{if $r['endtime']<$timestamp && $r['endtime']!=0}
									已過期 
								{elseif $r['state']==4}
									已退款
								{/if}
							{/if}
						</td>
						<td class="op">
							<a style="font-size:12px;" href="m.php?action=printbond&bid={$r['bid']}" target="_blank">
							<img src="{$cfg_site_url}/{TPL}images/buy917_printer.png" alt="Buy917 團購卷列印" />
							列印團購卷</a>
							<br />
							<img src="{$cfg_site_url}/{TPL}images/buy917_word.png" alt="Buy917 下載團購卷Word檔" />
							<a style="font-size:12px;" href="m.php?action=printbond&bid={$r['bid']}&type=word" target="_blank">
							下載Word</a>
						</td>
					</tr>
    			{/if}
                {/loop}
                    </tbody></table>
          <ul class="paginator">
                  {echo pagelist($total,$pagesize,$page,$theurl."&type=$type");}
                </ul>       
                 {/if}
              </div>

            </div>
            <div class="box-bottom"></div>
        </div>
    </div>
    <div id="sidebar">
        <div class="sbox">
            <div class="sbox-top"></div>
            <div class="sbox-content">
                <div class="side-tip">
                    <h3 class="first">什麼是Buy917團購券？</h3>
                    <p>Buy917團購券是當團購成功後，您自行下載列印使用的消費憑證（其中包含唯一優惠密碼）。</p>
                    <h3>如何使用Buy917團購券？</h3>
                    <p>當您消費時，出示列印的Buy917團購券即可。Buy917團購券上通常還包含更詳細的使用說明。</p>
					<h3>家中沒有印表機怎麼列印Buy917團購券？</h3>
                    <p>當您家中沒有印表機，可以下載Buy917團購卷Word檔，在上傳到7-11 ibon(<a href="http://www.ibon.com.tw/0100/file_upload.aspx" target='_blank'>
                    	http://www.ibon.com.tw/0100/file_upload.aspx</a>)，就可到住家附近的7-11列印團購卷。</p>
                </div>
            </div>
            <div class="sbox-bottom"></div>

        </div>
    </div>
</div>
            </div><!-- buy917_grouplist_body -->
            <div class="buy917_grouplist_bottom"></div>
    </div><!-- buy917_middle -->
</div><!-- buy917wrap -->
<!-- footer -->
<div id="buy917_footer">
	{template 'footer'}	
</div>
</body>
</html>
